import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect: '/form'
  },
  {
    path: '/form',
    name: 'form',
    component: () => import('../views/NvForm.vue')
  },
  {
    path: '/login',
    name: 'AdminLogin',
    component: () => import('../views/admin/Login.vue')
  },
  {
    path: '/admin',
    name: 'Admin',
    component: () => import('../views/admin/Index.vue'),
    children: [
      {
        path: "",
        name: 'AdminHome',
        component: () => import('../views/admin/Home.vue')
      },
      {
        path: 'que',
        name: 'QueTable',
        component: () => import('../views/admin/QueTable.vue')
      },
      {
        path: 'person',
        name: 'Persons',
        component: () => import('../views/admin/Persons.vue')
      }
    ]
  },
  {
    path: '*',
    redirect: '/form'
  }
]

const router = new VueRouter({
  base: process.env.BASE_URL,
  routes
})

export default router
